<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<head>
<base href="/">
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0,user-scalable=no, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="apple-mobile-web-app-capable" content="no" />
<meta name="format-detection" content="telephone=no">
<title>${goodsDetail.title}</title>
<script src="static/js/cssrem.js" crossorigin="anonymous"></script>
<link href="static/css/style.css" rel="stylesheet">
</head>

<body class="body-detail">
<input type="hidden" id="refreshed" value="no">
<!-- <script type="text/javascript">
    var e=document.getElementById("refreshed");  
    if(e.value=="no")e.value="yes";  
    else{e.value="no";location.reload();}
</script> -->
	<!-- 标题栏 -->
<script>
if (
  typeof test !== 'undefined' ||
  (typeof window.webkit !== 'undefined' && typeof window.webkit.messageHandlers.canJsGoBack !== 'undefined')
) {
  document.write(
    '<header class="header"><div class="header-bg"></div><div class="titlet-bar white"><a class="btn-goback dib" click="onGoBack"></a><div class="title ell">产品详情</div><a class="btn-share dib" href="javascript:;"></a></div></header>'
  )
}else{
  document.write(
    '<header class="header dn"><div class="header-bg"></div><div class="titlet-bar white"><a class="btn-goback dib" click="onGoBack"></a><div class="title ell">产品详情</div><a class="btn-share dib" href="javascript:;"></a></div></header>'
  )
}
</script>
	<!-- <header class="header">
		<div class="header-bg"></div>
		<div class="titlet-bar white">
			<a class="btn-goback dib" click="onGoBack"></a>
			<div class="title ell">产品详情</div>
			<script>
        if (typeof test !== 'undefined'||(typeof window.webkit !== 'undefined'&&navigator.userAgent.toLowerCase().match(/MicroMessenger/i) != 'micromessenger')) {
          document.write('<a class="btn-share dib" href="javascript:;"></a>')
        }
      </script>
		</div>
	</header> -->
	<!-- 获取H5域名 -->
	<input type="hidden" id="h5Domain" value="${h5Domain}">
	<div class="content content-detail ovh">
		<div class="goods-main detailbox">
			<div class="wrapper rel">
				<%-- <div class="activity-sign rel"><img src="${goodsDetail.labelCode}" width="100%"></div>  --%>
				<c:if test="${imgNum == 1}">
				<div class="banner photo100"><img src="${imgOne}" width="100%" alt=""></div>
				</c:if>
				<c:if test="${imgNum > 1}">
					<div class="banner swiper-container goods-banner">
						<div class="swiper-wrapper">
							<c:forEach items="${img}" var="imgs">
								<div class="swiper-slide photo100"><img src="${imgs}" width="100%" alt=""></div>
							</c:forEach>
						</div>
						<!-- Add Pagination -->
						<div class="swiper-pagination"></div>
					</div>
				</c:if>
				<c:if test="${goodsDetail.labelCode eq 'gold_bowl'}">
					<span class="icon-jfw dib"></span>
				</c:if>
				<c:if test="${goodsDetail.labelCode eq 'three_rural'}">
					<span class="icon-sn dib"></span>
				</c:if>
				
				<!-- 果树信息 -->
				<div class="detail-goods-info tc">
		          <div class="rel">
		            <h1 class="detail-goods-title b js-goods-title">${goodsDetail.title}</h1>
		            <p class="f24 g9 mt20 pt10 pl20 pr20">${goodsDetail.describe }</p>
		            <p class="money f38 b mt20">¥<em class="money-number js-price">${goodsDetail.price }</em></p>
		            <div class="tc f0 mt20 pt10">
		            <div class="dib vm">
		              <label class="label-period g9"><span class="dib f22">(第${goodsDetail.time }期)</span></label>
		              </div><div class="dib vm">
		                <div class="label-weight">
		                  <div><span class="f22">每${goodsDetail.unitDesc}</span></div>
		                  <div><span class="f22">约<em class="js-weight-average">${goodsDetail.expectHarvest }</em>${goodsDetail.harvestUnitDesc }</span></div>
		                </div>
		              </div>
		            </div>
		            <p class="detail-goods-tips f22 tc mt20">现在认养，预计${goodsDetail.pickMoth } 成熟</p>
		          </div>
		        </div>
		        
				<!-- 收益批次 -->
				<div class="detail-goods-column detail-goods-cycle mt20">
		          <div class="detail-goods-column-head f26 g6">收果周期：</div>
		          <c:if test="${harvestNum eq '1'}">
			         <div class="detail-goods-column-body cell">
			          <div class="cell-bd cycle-step--01 tc">
			            <p class="f24 g6">开始认养</p>
			            <p class="f24 g6">&emsp;</p>
			          </div>
			          <div class="cell-hd tc pl0">
			            <div class="detail-goods-stage">生长期</div>
			          </div>
			          <div class="cell-bd cycle-step--02 tc">
			            <p class="f24 g6">成熟采摘</p>
			            <p class="f24 g6">${goodsDetail.pickMoth }</p>
			          </div>
			          <div class="cell-hd tc pl0">
			            <div class="detail-goods-stage">包装、配送</div>
			          </div>
			          <div class="cell-bd cycle-step--03 tc">
			            <p class="f24 g6">确认收货</p>
			            <p class="f24 g6">(结束)</p>
			          </div>
			        </div>
		        </c:if>
		        <c:if test="${harvestNum gt '1'}">
		          <div class="detail-goods-column-body batch-list">
		            <div class="swiper-container">
		              <div class="batch-list-div swiper-wrapper">
		              	<c:forEach items="${gsth}" var="gsth" varStatus="status">
			                <div class="swiper-slide">
			                  <dl class="batch-item tc">
			                    <dt class="f32 pt20 mt10">第${status.index + 1}批</dt>
			                    <dd class="f36 weight mt10">${gsth.expectHarvest}  ${goodsDetail.harvestUnitDesc}</dd>
			                    <dd class="forecast f0 mt10">
			                      <span class="f20 tc">(预计收益)</span>
			                    </dd>
			                    <dd class="f24 time g6">${gsth.expectHarvestTime }</dd>
			                  </dl>
			                </div>
		                </c:forEach>
		              </div>
		            </div>
		          </div>
		          </c:if>
		          <div class="detail-goods-column-footer tc f24 g6">(万果田园为您提供免费邮寄服务)</div>
		        </div>
				<!-- 操作说明 -->
				<div class="detail-goods-column mt20 instructions">
		          <div class="detail-goods-column-head f26 g6">操作说明：</div>
		          <div class="detail-goods-column-body bgwh tc">
		            <div class="flow-chart"></div>
		          </div>
		        </div>
		        <!-- 基地 -->
		        <div class="detail-goods-column mt20 detail-goods-base">
		          <div class="detail-goods-column-head f0">
		            <dl class="dib vm">
		              <dt class="f26 g6">严选基地</dt>
		              <dd class="f28 g3">环境决定品质</dd>
		            </dl>
		          </div>
		         <a href="${h5Domain}/baseInfo?id=${goodsDetail.baseId }">
		          <div class="detail-goods-column-body bgwh cell pl20 pr20">
		            <div class="cell-hd photo100 base-pictu pl0"><img src="${goodsDetail.basePicke }" alt=""></div>
		            <div class="cell-bd">
		              <h6 class="f28 base-location g3">${goodsDetail.baseName }</h6>
		              <p class="f26 pt20 base-des g3">${goodsDetail.baseContent } </p>
		            </div>
		            <div class="cell-fd icon-ios-arrow-right pr0"></div>
		          </div></a>
		        </div>
			</div>
		</div>
		<div class="graphicbox detail-main bgwh ui-1px-t ge3">
			<div class="wrapper graphicbox-wrapper photo100 g3">${goodsDetail.content }</div>
		</div>
	</div>
	 <div class="column-buy cell">
	    <div class="cell-bd pr20">
	      <div class="money f28 mt10">¥<em class="dib vt js-money b f34">${goodsDetail.price * goodsDetail.minShopNum }</em>
	      </div>
	      <div class="pt10 f24 g6">已认养：<span class="goods-number">${goodsDetail.saleNum }</span>份 </div>
	    </div>
	    <div class="cell-fd">
	   			 <c:choose>
					<c:when test="${goodsDetail.stockNum == 0}">
						<a class="btn-buy f34 white disabled--1" href="javascript:;">已售罄</a>
					</c:when>
					<c:when test="${goodsDetail.saleType eq '00'}">
						<a class="btn-buy f34 white  disabled--1" href="javascript:;">已售罄</a>
					</c:when>
					<c:when test="${goodsDetail.state eq '00'}">
						<a class="btn-buy f34 white  disabled--1" href="javascript:;">已售罄</a>
					</c:when>
					<c:otherwise>
						<a class="btn-buy f34 white js-buy " href="javascript:;">立即认养</a>
					</c:otherwise>
				</c:choose>
	    </div>
	  </div>
	  <div class="column-buy-popup dn">
	    <div class="buy-popup-body bgwh">
	      <a class="btn-close" href="javascript:;"></a>
	      <div class="cell">
	        <div class="cell-hd goods-pictu photo100 pl0 ml20">
	          <img src="${goodsDetail.thumb}" alt=""> </div>
	        <dl class="cell-bd">
	          <dt class="f34 b">${goodsDetail.title}</dt>
	          <dd class="money pt20 f40 b">
	            <span class="f30">¥</span>${goodsDetail.price}</dd>
	          <dd class="cell mt20">
	            <div class="cell-bd f24 g9">已认养${goodsDetail.saleNum }${goodsDetail.unitDesc }</div>
	            <div class="cell-fd f24">剩余${goodsDetail.stockNum }${goodsDetail.unitDesc }</div>
	          </dd>
	        </dl>
	      </div>
	      <div class="income-tips"> 认养<span class="js-number">1</span>${goodsDetail.unitDesc }，预计收益约<span class="js-weight">${goodsDetail.expectHarvest }</span><span>${goodsDetail.harvestUnitDesc }</span>
	      </div>
	      <div class="cell pl20">
	        <div class="cell-bd"><span class="f30 g6">认养数量：</span><span class="f26 buy-tips dn">*单笔最多购买${goodsDetail.maxShopNum }${goodsDetail.unitDesc }</span>
	        </div>
	        <div class="cell-fd mod-number g3 mr20 pr0">
	          <span class="btn-number number-decrease ion-ios-minus-empty f40"></span>
	          <input class="number-input tc number-form" type="tel" min="${goodsDetail.minShopNum}" max="${goodsDetail.maxShopNum }" value="${goodsDetail.minShopNum}">
	          <span class="btn-number number-increase ion-ios-plus-empty f40"></span>
	        </div>
	      </div>
	      <div class="btn-buy js-btn-submit">确认</div>
	    </div>
	  </div>
	<!-- 下载提示页 -->
		<div class="explain dn">
			<div class="rs-arrow"><span class="rs-arrow-img"></span></div>
			<div class="rs-browser">
				<p>1.点击右上角</p>
				<p><span class="browser">2.选择</span>[在浏览器中打开]</p>
			</div>
			<div class="rs-know">
        <span class="rs-know-img"></span>
			</div>
		</div>
	<!-- 库存为0则说明 此商品不能再购买 -->
	<input type="hidden" id="stockNum" value="${goodsDetail.stockNum }">
	<!-- 售馨状态 00 售馨 01 售卖中 （状态等于00的时候 商品不能再购买）-->
	<input type="hidden" id="saleType" value="${goodsDetail.saleType }">
	<!-- 状态(00下架01上架) -->
	<input type="hidden" id="state" value="${goodsDetail.state }">
	<!-- 分享图片 -->
	<input type="hidden" id="thumb" value="${shareImg }">
	<script src="//cdn.bootcss.com/babel-polyfill/6.23.0/polyfill.min.js"></script>
	<script src="static/js/app.js"></script>
	<script src="static/js/details.js"></script>
	<script src="static/js/layer_mobile/layer.js"></script>
	<script src="//cdn.bootcss.com/Swiper/3.4.2/js/swiper.min.js"></script>
    <script src="//cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
    <script src="//cdn.bootcss.com/reqwest/2.0.5/reqwest.min.js"></script>
    <script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <script src="static/js/wx-share.js"></script>
	<script>
		new Swiper('.banner.swiper-container', {
	      pagination: '.swiper-pagination',
	      paginationClickable: true
	    });
	    new Swiper('.batch-list .swiper-container', {
	      slidesPerView: 'auto',
	      spaceBetween: 0,
	    });
	    buy();
	    function buy() {
	    	var btnBuy = $$('.js-buy');
	    	if(!btnBuy)return;
	      btnBuy.addEventListener('click', function () {
	        layer.open({
	          type: 1,
	          content: $$('.column-buy-popup').innerHTML,
	          anim: 'up',
	          style: 'position:fixed; bottom:0; left:0; width: 100%; border:none;',
	          success: function () {
	        	  
	        	submitform()
	        	  
	            var parent = $$('.layui-m-layercont')
	            var weightNum = parseFloat(
	              document.querySelector('.js-weight-average').textContent.trim()
	            )
	            var num = $$('.js-number').textContent
	            $$('.layui-m-layercont .number-form').value = num
	            var myQuantity = new Quantity('.layui-m-layercont .mod-number', {
	              onModify: function (number, _this) {
	                var tipsNumber = parent.querySelector('.buy-tips')
	                var money = document.querySelector('.js-money')
	                var price = document.querySelector('.js-price').textContent
	                var weight = parent.querySelector('.js-weight')
	                var enumber = document.querySelectorAll('.js-number');
	                [].forEach.call(enumber, function (item) {
	                  item.innerHTML = number
	                })
	                weight.innerHTML = (weightNum * number).toFixed(2)
	                money.innerHTML = (price * number).toFixed(2)
	                if (_this.max === number) {
	                  tipsNumber.classList.remove('dn')
	                } else {
	                  tipsNumber.classList.add('dn')
	                }
	              }
	            })
	            $$('.layui-m-layercont .btn-close').addEventListener('click', function () {
	              layer.closeAll()
	            })
	          }
	        });
	      })
	    }

	    function $$(element) {
	      return document.querySelector(element)
	    }
	
	 (function(){
		// 添加 home 入口
	    if ( typeof test !== 'undefined' ||(typeof window.webkit !== 'undefined' && typeof window.webkit.messageHandlers.canJsGoBack !==
	        'undefined')) {}else{
	    	var wrapper = document.querySelector('.wrapper')
	    	var inputed = document.querySelector('#h5Domain')
		      if (!!wrapper) {
		        wrapper.insertAdjacentHTML(
		          'afterbegin',
		          '<a class="btn-home" href="'+inputed.value+'/index"></a>'
		        )
		      }
	    }
	}());
	
		var androidUrl ='';
	    var iosUrl = '';
	    var thumbnail = document.querySelector('#thumb').value;
	    document.addEventListener("DOMContentLoaded",function () {
		      
		        share()
		      });
	
 	var layerIndex;
 	
function submitform(){
	var parent = $$('.layui-m-layercont')
  	var btn = parent.querySelector('.js-btn-submit');
  	var money = document.querySelector('.js-money');
  	var number = parent.querySelector('.number-form');
  	var url = "wap/pay/firmOrder?goodsSpecTimeId=${goodsDetail.id}&goodsTimeId=${goodsTimeId}";
  	var isSubmit = true;
 
  	
		btn.addEventListener('click', function(e) {
			var stockNum = document.querySelector('#stockNum');
			var saleType = document.querySelector('#saleType');
			var state = document.querySelector('#state');
			if(!isSubmit){
				return;
			}
			isSubmit = false;
			if (stockNum && stockNum.value.trim() === '0') {
				layerShow('<div><p>非常抱歉，</p><p>您查看的商品已售罄~</p></div>',
						function() {
							isSubmit = true;
							setTimeout(function() {
								layer.close(layerIndex);
							}, 2000)
						})
						
			} else if (saleType && saleType.value.trim() === '00') {
				layerShow('<div><p>非常抱歉，</p><p>您查看的商品已售罄~</p></div>',
						function() {
							isSubmit = true;
							setTimeout(function() {
								layer.close(layerIndex);
							}, 2000)
						})
			} else if (state && state.value.trim() === '00') {
				layerShow('<div><p>非常抱歉，</p><p>您查看的商品已下架~</p></div>',
						function() {
							isSubmit = true;
							setTimeout(function() {
								layer.close(layerIndex);
							}, 2000)
						})
			} else {
				e.preventDefault()
				var params = new Object();
				params.goodsSpecTimeId=${goodsDetail.id};
				params.goodsTimeId=${goodsTimeId};
				params.num=number.value;
				checkParams(params);
			}
			
		})

		function checkParams(params) {
	         axios({
	            method: 'post',
	            url: 'wap/pay/checkParams',
	            data: params,
	            headers: { 'X-Requested-With': 'XMLHttpRequest' }
	        }).then(function (res) {
	        	isSubmit = true;
	            var data = res.data;
	            var state = data.result.state;
	            console.log(res)
	            if (state == 1) {
	            	var newEa = document.createElement('a')
	            	newEa.href = url + '&num=' + number.value+'&v='+Date.now();
	            	newEa.click()
	            } else {
	            	var code = data.result.code;
	            	if(code == 'loginOut'){
	            		goLoginView();
	            	}else{
	            		if(data.jump_url != null){
	            		layer.open({
	            		    content: '<div><p>'+data.result.message+'</p></div>'
	            		    ,btn: ['去实名', '取消']
	            		    ,shadeClose:false
	            		    ,yes: function(index){
	            		      location.href = data.jump_url;
	            		    }
	            		  });
	            		}else{
		            		layerShow('<div><p>'+data.result.message+'</p></div>',
		            				function() {
									setTimeout(function() {
										layer.close(layerIndex);
									}, 2000)
							})
	            		}

	            	}
	            	
	            }

	        }).catch(function(err) {
	        	isSubmit = true;
	        });

    	}
}		
		function layerShow(html, callback) {
			layerIndex = layer.open({
				shade : false,
				className : 'layer-tips',
				title : [ '', 'display:none' ],
				content : html,
				success : function(index) {
					(callback && typeof (callback) === "function")
							&& callback(index);
				}
			});
		}


		// 获取 APP 下载链接
	    /* function fetchData() {
	      axios({
	        url: '/wap/getDownloadUrl',
	        method: 'get'
	      })
	        .then(function(res) {
	          var result = res.data.result
	          androidUrl = res.data.Android
	          iosUrl = res.data.iOS
	        })
	    } */

	      // 下载APP
	       function downloadApp(){
	        var buyBtn = document.querySelector('.js-buy')
	        var knowBtn = document.querySelector('.rs-know')
	        var explain = document.querySelector('.explain')
	        //buyBtn.addEventListener('click',function(e){
	          if (typeof test !== 'undefined') {
	          } else if (typeof window.webkit !== 'undefined'&&typeof window.webkit.messageHandlers.canJsGoBack !== 'undefined') {
	          }else{
	            explainSow()
	          }
	        //})
	        // 隐藏提示层
	        knowBtn.addEventListener('click',function(){
	          explain.classList.add('dn')
	        })
	      }
	      // 判断是否显示提示层
	      function explainSow() {
	        var u = navigator.userAgent
	        var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1
	        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
	        var ua = u.toLowerCase()
	        var explain = document.querySelector('.explain')
	        if (
	          ua.match(/MicroMessenger/i) == 'micromessenger' ||
	          u.indexOf('MQQBrowser') !== -1
	        ) {
	          //  if (isIOS) {
	          //  location.href = iosUrl
	          //} else {
	          //  explain.classList.remove('dn')
	          //} 
	          explain.classList.remove('dn')
	        } else if (ua.match(/WeiBo/i) == 'weibo') {
	          if (isIOS) {
	             explain.classList.remove('dn')
	          } else if (isAndroid) {
	            location.href = androidUrl
	          }
	        } else {
	        if (isAndroid) {
	          location.href = androidUrl
	        } else if (isIOS) {
	          location.href = iosUrl
	        }
	      }
	    }

	    // 分享操作
	    function share(){
	      var shareBtn = document.querySelector('.btn-share')
	      if(!shareBtn) return false
	      shareBtn.addEventListener('click',function(){
	        var infoData = {
	          state:'00',
	          url: location.href,
	          title: document.querySelector('.js-goods-title').textContent,
	          description: '我在万果田园发现了一个很好的产品，赶快来看看吧',
	          imgUrl:thumbnail
	        }
	        if (typeof test !== 'undefined') {
	          test.shareWeb(JSON.stringify(infoData))
	        } else if (typeof window.webkit !== 'undefined' && typeof window.webkit.messageHandlers.canJsGoBack !== 'undefined') {
	          window.webkit.messageHandlers.shareWeb.postMessage(infoData)
	        } else {
	        }
	      })

	    }
	    
	    
		function goLoginView(){
			if (typeof test !== 'undefined') {
		          test.goLoginView()
		    } else if (typeof window.webkit !== 'undefined' && typeof window.webkit.messageHandlers.canJsGoBack !== 'undefined') {
		      window.webkit.messageHandlers.goLoginView.postMessage('1111')
		    } else {
		    	location.href = '/wap/login/toLogin?forward='+decodeURI('/wap/goods/detail?id=${goodsTimeId}')+'&sourceChannel=0&v='+Date.now();
		    }
		};
				
		var wxwapShare = new WxShare({hasShare:false});
		// wap share
	    (function wapShare() {
	      var wxJs = wx
	      var wxConfig = {
	        appId: '',
	        timestamp: '',
	        nonceStr: '',
	        signature: ''
	      }
	      var ua = window.navigator.userAgent.toLowerCase()
	      var isWeixin = (ua.match(/MicroMessenger/i) == 'micromessenger' || ua.match(/_SQ_/i) == '_sq_') ? true : false
	      // 微信分享
	      function getWXConfig() {
	        var formData = new FormData()
	        formData.append('url', location.href)
	        axios({
	          method: 'post',
	          url: '/wap/wechat/wxValidate/getJsapiSigna',
	          data: formData,
	          headers: {
	            'X-Requested-With': 'XMLHttpRequest'
	          }
	        }).then(function (res){
	          wxConfig.appId = res.data.appId
	          wxConfig.timestamp = res.data.timestamp
	          wxConfig.nonceStr = res.data.noncestr
	          wxConfig.signature = res.data.signature
	          if (isWeixin) {
	            wxJs.config({
	              debug: false, //开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
	              appId: wxConfig.appId, //必填，公众号的唯一标识
	              timestamp: wxConfig.timestamp, //必填，生成签名的时间戳
	              nonceStr: wxConfig.nonceStr, //必填，生成签名的随机串
	              signature: wxConfig.signature, //必填，签名，见附录1
	              jsApiList: ['onMenuShareAppMessage', 'onMenuShareTimeline', 'onMenuShareQQ', 'onMenuShareWeibo'] //必填，需要使用的JS接口列表，所有JS接口列表见附录2
	            })
	            var title = document.querySelector('.js-goods-title').textContent,
	              linkUrl = location.href,
	              imgUrl = thumbnail
	              wxwapShare.getUserCode(function(inviteCode){
	            	 linkUrl = !!inviteCode ? wxwapShare.opath(linkUrl, inviteCode): linkUrl
	            	 console.log(linkUrl,inviteCode)
	                 WXshare(title, linkUrl, imgUrl)
	              })
	          }
	        })
	      }
	      
	      if(isWeixin){
	    	  getWXConfig();
	      }
	      
	      
	      function WXshare(title, linkUrl, imgUrl) {
	        wxJs.ready(function () {
	          console.log('通过ready接口处理成功验证')
	          // config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中。
	          wxJs.onMenuShareTimeline({
	            //朋友圈
	            title: title, // 分享标题
	            link: linkUrl, // 分享链接
	            imgUrl: imgUrl, // 分享图标
	            success: function () {
	              console.log('朋友圈分享成功')
	              // 用户确认分享后执行的回调函数
	            },
	            cancel: function () {
	              console.log('朋友圈分享失败')
	              // 用户取消分享后执行的回调函数
	            }
	          })
	          wxJs.onMenuShareAppMessage({
	            //微信朋友
	            title: title, // 分享标题
	            desc: '我在万果田园发现了一个很好的产品，赶快来看看吧', // 分享描述
	            link: linkUrl, // 分享链接
	            imgUrl: imgUrl, // 分享图标
	            type: 'link', // 分享类型,music、video或link，不填默认为link
	            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
	            success: function () {
	              console.log('微信朋友分享成功')
	              // 用户确认分享后执行的回调函数
	            },
	            cancel: function () {
	              console.log('微信朋友分享失败')
	              // 用户取消分享后执行的回调函数
	            }
	          })
	          wxJs.onMenuShareQQ({
	            //分享到QQ
	            title: title, // 分享标题
	            desc: '我在万果田园发现了一个很好的产品，赶快来看看吧', // 分享描述
	            link: linkUrl, // 分享链接
	            imgUrl: imgUrl, // 分享图标
	            success: function () {
	              console.log('QQ分享成功')
	              // 用户确认分享后执行的回调函数
	            },
	            cancel: function () {
	              console.log('QQ分享失败')
	              // 用户取消分享后执行的回调函数
	            }
	          })
	          wxJs.onMenuShareWeibo({
	            //分享到腾讯微博
	            title: title, // 分享标题
	            desc: '我在万果田园发现了一个很好的产品，赶快来看看吧', // 分享描述
	            link: linkUrl, // 分享链接
	            imgUrl: imgUrl, // 分享图标
	            success: function () {
	              console.log('微博分享成功')
	              // 用户确认分享后执行的回调函数
	            },
	            cancel: function () {
	              console.log('微博分享失败')
	              // 用户取消分享后执行的回调函数
	            }
	          })
	        })
	        wxJs.error(function (res) {
	          console.log('通过error接口处理失败验证', res)
	          // config信息验证失败会执行error函数，如签名过期导致验证失败，具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，对于SPA可以在这里更新签名。
	        })
	      }
	    }());
		
	</script>
	<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?24fb3d27099c50ae04b59301e492b50c";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
</body>

</html>